package com.tyk.bookstore.back.logistics.service.impl;


import com.tyk.bookstore.back.common.core.util.AssertUtil;
import com.tyk.bookstore.back.logistics.model.entity.ExpressCompanyDo;
import com.tyk.bookstore.back.logistics.model.result.ExpressCompanyResultEnum;
import com.tyk.bookstore.back.logistics.repository.ExpressCompanyRepository;
import com.tyk.bookstore.back.logistics.service.ExpressCompanyApiService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author tyk
 * @description 快递公司对内暴露接口
 */
@Service
@RequiredArgsConstructor
public class ExpressCompanyApiServiceImpl implements ExpressCompanyApiService {

    private final ExpressCompanyRepository expressCompanyRepository;


    @Override
    public void assertExistById(Long id) {
        AssertUtil.isTrue(
                expressCompanyRepository.exist1Eq(
                        ExpressCompanyDo::getId, id, ExpressCompanyDo.class
                ),
                ExpressCompanyResultEnum.EXPRESS_COMPANY_NOT_FOUND
        );
    }
}
